-
Notifications
You must be signed in to change notification settings - Fork 728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JDK21] Add support for JVMTI PopFrame #17809
Conversation
Previously, PopFrame returned JVMTI_ERROR_OPAQUE_FRAME for a virtual thread. In JDK21, PopFrame includes support for virtual threads as per the JVMTI specification: - Error if a virtual thread is not suspended and not the current thread. - Error if a virtual thread is unomunted since it won't be able to pop the current frame. - For a carrier thread with a virtual thread mounted, the details of the carrier thread are derived from targetThread->currentContinuation. Related: - eclipse-openj9#17715 - eclipse-openj9#17716 Also, there is no need to halt and resume a thread for inspection since PopFrame expects the thread to be suspended as per the JVMTI spec. If a thread is not suspended, it returns JVMTI_ERROR_THREAD_NOT_SUSPENDED. Signed-off-by: Babneet Singh <[email protected]>
The above requirement to suspend is enforced from JDK8 to JDK21: JDK8 - https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#PopFrame |
Verified locally that PopFrameTest passes with the changes from this PR. @tajila Requesting your review. |
currentThread, thread, &targetThread, JVMTI_ERROR_OPAQUE_FRAME, | ||
J9JVMTI_GETVMTHREAD_ERROR_ON_NULL_JTHREAD | J9JVMTI_GETVMTHREAD_ERROR_ON_DEAD_THREAD | J9JVMTI_GETVMTHREAD_ERROR_ON_VIRTUALTHREAD); | ||
currentThread, thread, &targetThread, JVMTI_ERROR_NONE, | ||
J9JVMTI_GETVMTHREAD_ERROR_ON_NULL_JTHREAD | J9JVMTI_GETVMTHREAD_ERROR_ON_DEAD_THREAD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it legal to continue if its a dead thread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, JVMTI_ERROR_THREAD_NOT_ALIVE
will be returned by getVMThread
when the J9JVMTI_GETVMTHREAD_ERROR_ON_DEAD_THREAD
flag is set.
/* Error if the thread is not suspended and not the current thread. */ | ||
if ((currentThread != targetThread) | ||
#if JAVA_SPEC_VERSION >= 21 | ||
&& (0 == J9OBJECT_U32_LOAD(currentThread, threadObject, vm->isSuspendedInternalOffset)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be checking current thread or target thread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check if the input/target thread
is suspended. If thread != currentThread
&& thread is not suspended
, then JVMTI_ERROR_THREAD_NOT_SUSPENDED
is returned.
jenkins compile win jdk11 |
jenkins test sanity alinux64 jdk21 |
- StopThreadTest fixed by eclipse-openj9/openj9#17806 - PopFrameTest fixed by eclipse-openj9/openj9#17809 - GetSetLocalUnsuspended fixed by eclipse-openj9/openj9#17829 Closes eclipse-openj9/openj9#17711 Closes eclipse-openj9/openj9#17715 Closes eclipse-openj9/openj9#17716 Closes eclipse-openj9/openj9#17717 Closes eclipse-openj9/openj9#17718 Signed-off-by: Babneet Singh <[email protected]>
- StopThreadTest is fixed by eclipse-openj9/openj9#17806. - PopFrameTest is fixed by eclipse-openj9/openj9#17809. - GetSetLocalUnsuspended is fixed by eclipse-openj9/openj9#17829. Closes eclipse-openj9/openj9#17711 Closes eclipse-openj9/openj9#17715 Closes eclipse-openj9/openj9#17716 Closes eclipse-openj9/openj9#17717 Closes eclipse-openj9/openj9#17718 Signed-off-by: Babneet Singh <[email protected]>
- StopThreadTest is fixed by eclipse-openj9/openj9#17806. - PopFrameTest is fixed by eclipse-openj9/openj9#17809. - GetSetLocalUnsuspended is fixed by eclipse-openj9/openj9#17829. Closes eclipse-openj9/openj9#17711 Closes eclipse-openj9/openj9#17715 Closes eclipse-openj9/openj9#17716 Closes eclipse-openj9/openj9#17717 Closes eclipse-openj9/openj9#17718 Signed-off-by: Babneet Singh <[email protected]>
Previously, PopFrame returned JVMTI_ERROR_OPAQUE_FRAME for a virtual
thread.
In JDK21, PopFrame includes support for virtual threads as per the
JVMTI specification:
thread.
pop the current frame.
the carrier thread are derived from targetThread->currentContinuation.
Related:
Also, there is no need to halt and resume a thread for inspection since
PopFrame expects the thread to be suspended as per the JVMTI spec. If a
thread is not suspended, it returns JVMTI_ERROR_THREAD_NOT_SUSPENDED.